export class Repository {

    constructor() {
        if (new.target === Repository) {
            throw new Error("Repository is an abstract class and cannot be instantiated directly.");
        }
    }

    /**
     * 新增一个仓储实例
     * @param {string} business 
     */
    newQuery = async (business = '') => {
        throw new Error("Method 'newQuery()' must be implemented.");
    }

    success = (data, message = 'success') => {
        return {
            code: 200,
            data,
            message: 'success'
        }
    }
    error = (code = 500, message = 'error') => {
        return {
            code,
            message: 'error',
            data: null
        }
    }
}